package Meituan;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

/**
 * 不可修改map
 * @author: leiwenkang02@meituan.com
 * @date: 2018/9/8
 * @time: 16:52
 */
public class Test23 {
    public static void main(String[] args) {
        Map<Integer, Integer> map = new HashMap<>();
        map.put(1, 10);
        map.put(2, 20);
        Map<Integer, Integer> unMap = Collections.unmodifiableMap(map);
        unMap.put(3, 30);
        for (Map.Entry<Integer, Integer> entry : unMap.entrySet()) {
            System.out.println(entry.getKey());
            System.out.println(entry.getValue());
        }
    }
}
